<template>
  <el-dialog :title="title" :close-on-click-modal="false" :fullscreen="true" :visible.sync="visible"
    :before-close="cancel" class="JNPF-dialog JNPF-dialog_center" lock-scroll width="50%">
    <el-row class="JNPF-common-search-box" :gutter="16">
      <el-form @submit.native.prevent ref="elForm" :model="dataForm" :rules="rules">
        <el-col :span="8">
          <el-form-item label="巡查单号" prop="FBILLNO">
            <el-input v-model="dataForm.FBILLNO"  disabled />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="巡查日期" prop="FBILLCREDATE" >
            <el-date-picker v-model="dataForm.FBILLCREDATE" value-format="yyyy-MM-DD" type="date" placeholder="选择日期" disabled>
            </el-date-picker>
          </el-form-item>
        </el-col>

        <el-col :span="8">
            <el-form-item label="巡查状态">
              <el-select v-model="dataForm.FBILLSTATE" placeholder="请选择" disabled>
                <el-option
                  v-for="item in options1"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

        <el-col :span="8">
          <el-form-item label="巡查人员" prop="FUSER" >
            <el-input v-model="dataForm.FUSER"   disabled/>
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="巡查线路" prop="FLINENAME" >
            <el-input v-model="dataForm.FLINENAME"  disabled />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="场地名称" prop="FPOINT" >
            <el-input v-model="dataForm.FPOINT" disabled  />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="开始时间" prop="FBEGTIME" >
            <el-input v-model="dataForm.FBEGTIME" disabled  />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="结束时间" prop="FENDTIME" >
            <el-input v-model="dataForm.FENDTIME" disabled  />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="巡查计划" prop="FSRCNO" >
            <el-input v-model="dataForm.FSRCNO" disabled  />
          </el-form-item>
        </el-col>

        <el-col :span="16">
          <el-form-item label="巡查备注" prop="FMEMO" >
            <el-input v-model="dataForm.FMEMO"   />
          </el-form-item>
        </el-col>
        
        <!-- <el-col :span="5">
          <el-form-item label="">
            <el-button type="success" icon="el-icon-plus" @click="insert">添加场地</el-button>
            <el-button type="primary" :loading="loading">返回</el-button>
          </el-form-item>
        </el-col> -->
      </el-form>
    </el-row>

    <template>
     <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
      <el-tab-pane label="巡查记录" name="first">
        <el-table :data="list" border stripe>
          <!-- <el-table-column label="操作" width="80">
            <template slot-scope="scope">
              <el-button slot="reference" icon="el-icon-delete" style="color: red" @click="shopdate(scope.$index)"
                type="text">删除</el-button>
            </template>
          </el-table-column> -->
          <el-table-column prop="FENTRYID" label="序号" width="85" ></el-table-column>
          <el-table-column prop="FCATTYPE" label="评测分类" width="115"></el-table-column>
          <el-table-column prop="FITEM" label="评测项目" width="135"></el-table-column>
          <el-table-column prop="FNAME" label="标准和说明" ></el-table-column>
          <el-table-column prop="FPOINT" label="得分" width="85"></el-table-column>
          <el-table-column prop="FMEMMO" label="备注" ></el-table-column>
        </el-table>
      </el-tab-pane>

      <el-tab-pane label="巡查结论" name="second">
        <el-row class="JNPF-common-search-box" :gutter="16">
      <el-form @submit.native.prevent ref="elForm" :model="dataForm" :rules="rules">
       
        <el-col :span="24">
          <el-form-item label="问题概述" prop="FNOTE">
            <el-input
              type="textarea"
              :rows="2"
              placeholder="请输入内容"
              v-model="textarea">
            </el-input>
          </el-form-item>
        </el-col>

        <el-col :span="8">
            <el-form-item label="整改要求">
              <el-select v-model="dataForm.FBILLSTATE" placeholder="请选择">
                <el-option
                  v-for="item in options3"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

        <el-col :span="8">
          <el-form-item label="整改日期" prop="FUSER2">
            <el-input v-model="dataForm.FUSER2"   />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="巡查得分" prop="FUSERDATE2">
            <el-input v-model="dataForm.FUSERDATE2"  disabled />
          </el-form-item>
        </el-col>
        
        <el-col :span="5">
          <el-form-item label="">
            <el-button type="success" icon="el-icon-plus" @click="closePage">保存</el-button>
            <el-button type="primary" :loading="loading"  @click="closePage">取消</el-button>
          </el-form-item>
        </el-col>
      </el-form>
      </el-row>
      </el-tab-pane>

    </el-tabs>
    </template>

     

    <StudqueryFcuston ref="StudqueryFcuston" @confirm="shoplist" />
  </el-dialog>
</template>
<script>
  import StudqueryFcuston from "@/components/StudqueryFcuston/StudqueryFcuston.vue"
  import jnpf from "@/utils/jnpf"
  export default {
    components: { StudqueryFcuston },
    props: {
      formationlist: {
        type: Array,
        default: [],
      },
    },
    data() {
      return {
        activeName: 'first',
        title: "新增",
        insertorupdate: true,
        dataForm: {
            FBILLNO: "X24120001", 
            FBILLCREDATE:"2024-12-29",
            FUSER: "王莽",
            FLINENAME: "巡查1路",
            FPOINT:"1教楼101教室",
            FBEGTIME:"18:00",
            FENDTIME:"20:00",
            FMEMO: "每天执行并上报",
            FSRCNO:"K241130001",
            FCHECKUSE: "",
            FCHECKDATE: "",
            FBILLTYPE:"日巡查",
            FBILLSTATE: "已完成"
        },
        rules: {
          FMEMO: [
            { required: true, message: '请输入巡查备注', trigger: 'blur' },
          ],
        },
        list: [{  "FENTRYID":1,
                  "FCATTYPE": "1.安全责任与文化",
                  "FITEM":"",
                  "FNAME":"",
                  "FPOINT": "",
                  "FMEMMO": ""
                },
                { "FENTRYID":2,
                  "FCATTYPE": "",
                  "FITEM":"-安全信息牌",
                  "FNAME":"门口信息牌信息完整、准确（责任人、应急电话、危险源等）",
                  "FPOINT": "2",
                  "FMEMMO": ""
                },
                { "FENTRYID":3,
                  "FCATTYPE": "",
                  "FITEM":"-安全责任制",
                  "FNAME":"安全责任书签订到位，人员清楚自身安全职责",
                  "FPOINT": "3",
                  "FMEMMO": ""
                },
                { "FENTRYID":4,
                  "FCATTYPE": "",
                  "FITEM":"-安全准入与培训",
                  "FNAME":"新进入员经过安全培训并记录，涉及特殊设备需持证上岗",
                  "FPOINT": "5",
                  "FMEMMO": ""
                }
                ,
                {  "FENTRYID":5,
                  "FCATTYPE": "2.用电与消防安全",
                  "FITEM":"",
                  "FNAME":"",
                  "FPOINT": "",
                  "FMEMMO": ""
                },
                { "FENTRYID":5,
                  "FCATTYPE": "",
                  "FITEM":"-大功率电器",
                  "FNAME":"无违规使用取暖器、电水壶等大功率电器",
                  "FPOINT": "4",
                  "FMEMMO": ""
                },
                { "FENTRYID":6,
                  "FCATTYPE": "",
                  "FITEM":"-配电箱",
                  "FNAME":"配电箱前无杂物遮挡，内部无漏电、电线老化现象",
                  "FPOINT": "1",
                  "FMEMMO": ""
                }],
        loading: false,
        visible: false,

        //所属校区选择数据
        options1: [{
          value: '1',
          label: '申请中'
        }, {
          value: '2',
          label: '已通过'
        }, {
          value: '3',
          label: '已驳回'
        }],

        //所属校区选择数据
        options2: [{
          value: '1',
          label: '教学申请'
        }, {
          value: '2',
          label: '培训人员'
        }, {
          value: '3',
          label: '外来人员'
        }],
        
      };
    },
    created() {
    },
    mounted() { },
    methods: {
      //
      init(FBILLNO) {
        this.dataForm.FBILLNO = FBILLNO;
        if (this.dataForm.FBILLNO) {
          this.title = "修改"
          this.insertorupdate = false;
        }
        else {
          this.title = "新增"
          this.dataForm.FBILLNO = "K" + Math.floor(Math.random() * 10000000) + 1;
          this.insertorupdate = true;
        }
        this.visible = true;
      },
      insert() {
        this.$refs.StudqueryFcuston.open();
      },
      shoplist(data) {
        data.forEach(item => {
          this.list.push({
            FBILLNO: this.dataForm.FBILLNO
            , FENTRYID: "1"
            , FYEAR: 2024
            , FGRADE: "大一"
            , FCLASS: "化学系1班"
            , FSTUDNAME: "曹操"
          },{
            FBILLNO: this.dataForm.FBILLNO
            , FENTRYID: "2"
            , FYEAR: 2024
            , FGRADE: "大一"
            , FCLASS: "化学系1班"
            , FSTUDNAME: "刘备"
          })
        });
      },
      //
      cancel() {
        this.$refs.elForm.resetFields();
        this.list = [];
        this.visible = false;
      },
    },
  };
</script>